rob_w has quit [Remote host closed the connection]
Hunar has joined #picolisp
<Hunar>
Hello :) My eyes hurt after looking at so many pil codes, everything is one color when using vim, and the worst thing is using '('B will make vim think that ( is a string and doesn't show useful brace-matching information, did anyone make a syntax highlighter for pil in vim? I'm currently trying to highlight the functions (filter getd (all)) but
<Hunar>
I've never touched vimscript, I wanted to know if anyone else already did this, I couldn't find it in google
<Regenaxer>
hehe
<Regenaxer>
I reommend Vip
alexshendi has quit [Quit: -a- Connection Timed Out]
<Regenaxer>
Mia made a series of vip articles. Will come out soon I think
<Hunar>
I really want to use vip also, but currently I do alooot of refactoring and I'm constantly using visual select :(
<Regenaxer>
I see
<Regenaxer>
buw visual select is slow
<Regenaxer>
compared to vi-style editing
<Hunar>
selecting a box of code, delete them, instert into multiple lines the same text at the same time, etc...
<Hunar>
I also use alot of macros (I think they're called macros, you press q then letter and do something, it will record it and play it back when you need it)
<Regenaxer>
yes, right
<Regenaxer>
This is all stuff I did not use, so it is not in Vip (yet)
alexshendi has joined #picolisp
<Hunar>
one question, the code above (which you told me months ago) (filter getd (all)) gets the functions, what other similar filters are there so that I can give them other colors when highlighting
<Regenaxer>
for example 'pat?'
<Regenaxer>
like @A
<Hunar>
That would be good too :) basically I want the user to see that this is a thing from the language and not made by the user, so all the symbols in (all) but some of the items I don't understand, like what is A B C E etc.. the first results when you run (all)
<Regenaxer>
(all) has all symbols in the current namespace, so you get also symbols used as variables and other stuff
<Regenaxer>
So also e.g. 'A' may be bound to a function in the moment you run your test
<Regenaxer>
if Vip binds it locally
<Hunar>
I'll come back to this when I figure out how to use vimscript :) so far I know getd and pat? .. I'll ask more in the future.. another question, why some functions take other functions quoted and unquoted while some others only take quoted functions?
<Regenaxer>
Pil is all dynamic, everything changes ;)
<Regenaxer>
Functions normally don't care
<Regenaxer>
they evaluate their args
<Regenaxer>
So it is not the function that "takes" a quoted function
<Regenaxer>
It is how you call it
<Regenaxer>
(mapcar (list '(X) '(* X X)) ...
<Regenaxer>
(mapcar '((X) (* X X)) ...
<Regenaxer>
the same
<Regenaxer>
The point is what comes out *after* evaluatien
<Regenaxer>
this is then given to the function
<Hunar>
I don't currently remember the one that failed if I didn't give a quoted function .. but this is the other one (mapcar '+ and mapcar + both work
<Regenaxer>
yes, because the interpreter evals in this case until it finds a function
<Hunar>
Aha
<Hunar>
I see
<Regenaxer>
(setq C + B 'C A 'B) (mapcar C ...
<Regenaxer>
so (mapcar + is best
<Regenaxer>
but one thing to be careful is OOP messags
<Regenaxer>
(mapcar 'foo> (list of objects))
<Regenaxer>
This won't work (mapcar foo> (list of objects))
<Regenaxer>
because message passing needs the *symbol*, not just the function
<Hunar>
:)
<Regenaxer>
This is a bit unlucky
<Regenaxer>
but can't be avoided
<Hunar>
I also get confused and never remember which comes first when using get nth head tail the index or the list, what is a good way to think about it and remember?
<Regenaxer>
Perhaps there is no clear rule
<Regenaxer>
(get List 3)
<Regenaxer>
(nth List 3)
<Regenaxer>
hmm
<Regenaxer>
I always forget for 'cut'
<Regenaxer>
(cut 3 Lst)
<Hunar>
while coding I keep a small terminal open just to test these small problems
<Regenaxer>
(cut 3 'Lst) better
<Regenaxer>
me too, and the 'doc's
<Hunar>
Why didn't you make all of them the same :)
<Regenaxer>
Some are historical from other Lisps
<Regenaxer>
And for some it is necessary
<Regenaxer>
like nth and get take further args
<Regenaxer>
(get Sym 'a 3 'b 7)
<Regenaxer>
So Sym or Lst must be first
Hunar has quit [Quit: Client closed]
Hunar has joined #picolisp
<Hunar>
Right :) no problem .. I had a similar situation once when creating a compiler for an esoteric programming language, made a function to subtract two memory locations but didn't know which one should come first and in which one should I put the result back when i finish
<Regenaxer>
yeah, exactly
<Regenaxer>
sub a, b
<Regenaxer>
For example
<Regenaxer>
(rid 'var 'any) vs (del 'any 'var)
<Regenaxer>
They are similar
<Hunar>
T
<Regenaxer>
but 'del' is related to 'delete'
<Regenaxer>
which is ancient Lisp
<Regenaxer>
And if you read in English, you have
<Regenaxer>
"Rid var from any"
<Regenaxer>
"Del any from var"
<Regenaxer>
no
<Regenaxer>
"Rid var of any"
<Regenaxer>
In English to get rid somethig of something
<Regenaxer>
versus "delete any from the list in var"
<Regenaxer>
puh
<Hunar>
That sentence would also require a non English speaker to think in English :)
<Regenaxer>
probably
<Regenaxer>
'rid' is recent
<Regenaxer>
a few months ago
<Regenaxer>
and I was thinking a long time about the arg order
<Regenaxer>
Finally I thought the current way is best
<Regenaxer>
also because 'rid' goes together with 'fiforq
<Regenaxer>
'fifo'
<Regenaxer>
(fifo 'var ['any ..])
<Hunar>
Now I'm curious to see what was the final decision in my old project, I'll take a look
<Regenaxer>
good :)
<Hunar>
It was subV(from, to) with the explanation of (subtracts from from to and putts the result in to) I think its logical :/
<Regenaxer>
T
<Regenaxer>
In various assembly langs I saw both orders
<Hunar>
My english skills break down when i see (subtract a from b), I always forget it means a-b or b-a :(
<Regenaxer>
:)
<Hunar>
I got distracted alot :) back to work, thanks :D
<Regenaxer>
Yep
Hunar has quit [Ping timeout: 256 seconds]
<beneroth>
Regenaxer, rid? whats the difference to 'del besides syntax sugar?
<beneroth>
ah multiple occurences
<beneroth>
and circ list handling
<beneroth>
I see
<Regenaxer>
yes
<Regenaxer>
and, most important, 'rid' is destructive
<Regenaxer>
That's why I said it goes with 'fifo'
<Regenaxer>
I was surprised how hard it is to remove something from a fifo list, i.e. a circular list
<Regenaxer>
Of course no way to do it non-destructively
<Regenaxer>
But even destructively it is a bit tricky
<beneroth>
yeah makes sense
theruran_ has joined #picolisp
<razzy>
weird. (setq @X 1234) (fill '@X) works in REPL but not in ^e vip
<Regenaxer>
Perhaps @X is bound in Vip
<Regenaxer>
What about @FooBar ?
<razzy>
there is little change, but also does not work
<Regenaxer>
In Vip here:
<Regenaxer>
: (setq @X 1234)
<Regenaxer>
-> 1234
<Regenaxer>
Undefined
<Regenaxer>
: (fill '@X)
<Regenaxer>
: (nsp 'fill)
<Regenaxer>
-> llvm
<Regenaxer>
: (pico~fill '@X)
<Regenaxer>
-> 1234
<Regenaxer>
This is because I did (vi 'fill)
<Regenaxer>
So first namespace is 'llvm'
<Regenaxer>
In general I think the Vip repl has to be used tith care
<Regenaxer>
Makes sense inside a given application
<Regenaxer>
but perhaps not in general
<Regenaxer>
Because this REPL runs *inside* Vip
<Regenaxer>
It is for extending Vip etc
<Regenaxer>
But for your example, if I do $ vi a
<Regenaxer>
: (setq @X 1234)
<Regenaxer>
-> 1234
<Regenaxer>
: (fill '@X)
<Regenaxer>
-> 1234
<Regenaxer>
So it works here
<razzy>
ok, weirder, clean vi works. after i load my file, it stop working
<Regenaxer>
What exactly is the result?
<razzy>
G->NIL
<Regenaxer>
G?
<razzy>
red G
<Regenaxer>
Red means "control"
<Regenaxer>
^G
<Regenaxer>
Somebody prints ^G
<Regenaxer>
Strange
<razzy>
i am tired, will try in morning.
<Regenaxer>
:)
<razzy>
also i am trying (in '(curl urlStart VarA urlRest)) and having bad luck using fill and pack. just cannot put variable into URL.
<Regenaxer>
This sounds rather easy
<Regenaxer>
Just ask here
<razzy>
i want this (fill (quote a c d e @X a)), but without space between e @X A
<Regenaxer>
This is a misunderstanding. There is no space
<Regenaxer>
it is a list
<Regenaxer>
You mean the char <space>, right? ASCII 32
<razzy>
hmm, I am really tired :D
<razzy>
sorry for bothering you
<Regenaxer>
Nono, no bothering
<Regenaxer>
I think you mixed up 'pack' with 'fill' (?)
<razzy>
i had trouble with pack. I was hoping to help myself with fill.
<Regenaxer>
both are useful
<razzy>
fill is only for lists/
<Regenaxer>
'pack' is probably more often used
<razzy>
is there a way to take transient symbol "alfa beta gama" and append it to list (a b c)? result: (a b c alfa beta gama) ?
<Regenaxer>
yes
<Regenaxer>
append or conc
<Regenaxer>
(append (a b c) (list "alfa beta gama"))
<razzy>
i was not expecting this easy :] thank you
<razzy>
i meant simple
<Regenaxer>
ok :)
razzy has quit [Ping timeout: 256 seconds]
razzy has joined #picolisp
alexshendi has quit [Quit: -a- IRC for Android 2.1.59]