--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
--
Hey Robert,Just wanted to give you a heads-up that I'll be experimenting with this branch in the lfetool rewrite -- so you'll probably start seeing lots of questions from me!d
On Sun, Jun 1, 2014 at 3:24 PM, Robert Virding <rvir...@gmail.com> wrote:
I did discover a way to get arrays into classic sh which doesn't have arrays: you can the positional parameters as a circular buffer/array. And if you use set to append a new element then you don't get problem of appending a string. So
set -- "$@" $newvalue
will append $newvalue to the "array" without problems. And then shift to remove elements from the head. Of course you can only prepend or append values, but appart from that it works like a charm. Look in the lfe-dev branch at lfe-1 and lfescript for examples.
Robert
On Thursday, May 29, 2014 9:14:27 PM UTC+2, Duncan McGreggor wrote:Yeah, that's tricky... I'm facing something similar with lfetool. I've even considered taking on the work of converting it to lfescript ;-) (with a bootstrapping phase).Bash will be faster than C (for the things I've measured in the past, anyway). But who's counting milliseconds with this sort of thing? I'd go for what is going to be easier to maintain in the long run ...dOn Thu, May 29, 2014 at 11:54 AM, Robert Virding <rvir...@gmail.com> wrote:
All that is left is to decide which language to write it in. sh is easy but handling the args can lead to the need for complex quoting when writing the calls. Args with spaces in them are messy to get right. With C that is easy and the code is not much more difficult either.
Robert
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
From the discussions we had at our LUG (LFE user group, or perhaps LFEUG?)
meeting I assumed that people approved of the "new" way for the lfe and lfescript to handle arguments. So I will add these ideas into the standard 'develop' branch soon.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
--
Re-posting, firefox sometimes hangs and hides what I have written without giving me anyway to access it.Next version complete and now pushed into the latest commit in 'develop' branch. The 'lfe-dev' branch will soon be deleted.
Both lfe and lfescript take arguments in the form
lfe [-flag1 val1 val2 -flag2 --] script-name script-args
(script-name and script-args are optional in lfe of course). If you use flags you MUST end them with a -- or -extra. Lfescript checks for shebangs in the same style as escript, i.e. a comment in line 2 or 3 starting with ;;! where the rest of the line becomes flags for the erl command. This is not done for the script in the lfe command but I have been thinking of including that as well.
The goal of the new lfe command is to be like sh and there is practically no need for lfescript unless you want to compile the module (which you can't do yet anyway :-))In the bin directory there is lfe, lfec and lfescript plus lfe-test and lfeexec. They are made to be linked to from your bin directory and not copied into it. If you do copy them they won't work. This will make installing easier but more sensitive.What also needs to be fixed is how the lfe command line arguments should past into the script. Now there are two shell variables: Prog which contains the name of the script and Args which contains a list of the script arguments. Pretty much like sh $0 and $@. Open to suggestions on this.
Quick follow-up below:
On Sunday, June 15, 2014 at 5:06:46 PM UTC-5, Robert Virding wrote:Re-posting, firefox sometimes hangs and hides what I have written without giving me anyway to access it.Next version complete and now pushed into the latest commit in 'develop' branch. The 'lfe-dev' branch will soon be deleted.
Both lfe and lfescript take arguments in the form
lfe [-flag1 val1 val2 -flag2 --] script-name script-args
(script-name and script-args are optional in lfe of course). If you use flags you MUST end them with a -- or -extra. Lfescript checks for shebangs in the same style as escript, i.e. a comment in line 2 or 3 starting with ;;! where the rest of the line becomes flags for the erl command. This is not done for the script in the lfe command but I have been thinking of including that as well.
The goal of the new lfe command is to be like sh and there is practically no need for lfescript unless you want to compile the module (which you can't do yet anyway :-))In the bin directory there is lfe, lfec and lfescript plus lfe-test and lfeexec. They are made to be linked to from your bin directory and not copied into it. If you do copy them they won't work. This will make installing easier but more sensitive.What also needs to be fixed is how the lfe command line arguments should past into the script. Now there are two shell variables: Prog which contains the name of the script and Args which contains a list of the script arguments. Pretty much like sh $0 and $@. Open to suggestions on this.Not sure if anyone else is using this, but I've started running more scripts with lfe. From inside the script, to get the name of the script that you called and any arguments you passed to it, you have the following variables available:* script-name* script-args
(defun main ()(main script-args))
(main)
Some more notes:
Not sure if anyone else is using this, but I've started running more scripts with lfe. From inside the script, to get the name of the script that you called and any arguments you passed to it, you have the following variables available:* script-name* script-argsNote that the script as a whole is executed; it's not like using lfe -s <module> where a start/0 function is called, nor using lfescript, where a main/1 function is called. You'll need to call your desired function at the end of the script.Here's a convention I've started using:* define all my functions* define a main/n with as many args as expected* define a main/1 that inserts defaults and/or does pattern matching on the script args (calling main/n)* define a main/0 like so:(defun main ()(main script-args))And then, at the end of the script file, simply do:(main)